# 导包
import jsonschema

# 准备效验数据
data = {
    "success": True,
    "code": 10000,
    "message": "操作成功"
}

# 对数据进行jsonschema规范
schema = {
    "type": "object",
    "properties": {
        "success": {"const": True},
        "code": {"const": 10000},
        "message": {"const": "操作成功"}
    }
}

# 进行校验
res = jsonschema.validate(instance=data, schema=schema)
print("res=", res)
